package com.zhengqing.design.action.state._01;

/**
 * <p> 状态接口 </p>
 *
 * @author zhengqingya
 * @description
 * @date 2022/12/22 11:33
 */
public interface State {
    void doAction(Context context);
}

class StartState implements State {

    @Override
    public void doAction(Context context) {
        System.out.println("Player is in start state");
        context.setState(this);
    }

    @Override
    public String toString() {
        return "Start State";
    }
}

class StopState implements State {

    @Override
    public void doAction(Context context) {
        System.out.println("Player is in stop state");
        context.setState(this);
    }

    @Override
    public String toString() {
        return "Stop State";
    }
}
